/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package technotheist.data.grid;

import java.util.EnumMap;
import technotheist.data.BVec;
import technotheist.data.BufferManager;
import technotheist.data.wrap.BMatrix3D;

/**
 *
 * @author Mitch
 */
public class Volume<T> {
    public final int cnt;
    public final EnumMap<BorderType, BorderPlane<T>> borders;
    public final Layer<T>[] layers;
    public final BMatrix3D<T> volume;
    public final BVec.Size vecSize;

    public Volume(BufferManager mngr, Class type, BVec.Size vs, int layers, int width, int breadth) {
	this.cnt = layers;
	this.vecSize = vs;
	this.layers = new Layer[cnt];
	this.volume = (BMatrix3D<T>) mngr.createMatrix3D(mngr.createTBuffer(type, vs, layers * width * breadth), layers, width, breadth);
	this.borders = new EnumMap<>(BorderType.class);
	for (int x = 0; x < cnt; x++) {
	    this.layers[x] = new Layer<>(mngr, this, x);
	}
	borders.put(BorderType.Left, new BorderPlane(BorderType.Left, mngr.createMatrix2D(mngr.createTBuffer(type, vs, cnt), layers, breadth)));
	borders.put(BorderType.Right, new BorderPlane(BorderType.Right, mngr.createMatrix2D(mngr.createTBuffer(type, vs, cnt), layers, breadth)));
	borders.put(BorderType.Front, new BorderPlane(BorderType.Front, mngr.createMatrix2D(mngr.createTBuffer(type, vs, cnt), layers, width)));
	borders.put(BorderType.Back, new BorderPlane(BorderType.Back, mngr.createMatrix2D(mngr.createTBuffer(type, vs, cnt), layers, width)));
    }
    
}
